<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Facades\Utils\QiniuFileManager;

class Rear extends Model
{
    protected $table = 'rears';

    protected $fillable = [
    	'id',
    	'weight',
    	'bmi',
    	'gi',
    	'waistline',
    	'hipline',
        'picture',
    	'level_id',
        'case_id'
    ];

    protected $appends=[
        'picture_url'
    ];

    public function getPictureUrlAttribute()
    {
        if(isset($this->attributes['picture'])){
            return $this->attributes['picture_url']=QiniuFileManager::getFileUrl($this->attributes['picture'],'public');
        }
    }
}
